# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=hdrhistogram-c
_projname=HdrHistogram_c
pkgver=0.9.13
pkgrel=1
pkgdesc="High Dynamic Range (HDR) Histogram in C"
url="https://github.com/HdrHistogram/HdrHistogram_c"
arch="all"
license="BSD-2-Clause"
makedepends="cmake zlib-dev"
subpackages="$pkgname-static $pkgname-dev"
source="https://github.com/HdrHistogram/HdrHistogram_c/archive/$pkgver/$_projname-$pkgver.tar.gz
	use-custom-hdr_getline-func-for-all-platforms.patch
	"
builddir="$srcdir/$_projname-$pkgver"

build() {
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DHDR_HISTOGRAM_BUILD_PROGRAMS=True
	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install

	# Don't package tests and example programs.
	rm -Rf "$pkgdir"/usr/bin
}

sha512sums="1b9d44c76d1cd09110876f14ef7a88601143ec17c88a78908e8fcb1feabfaa53fe222ddc72170d1fa18506586a37a6c05694073488094fd80e793a4ec63f4919  HdrHistogram_c-0.9.13.tar.gz
243f6387ad24218acf3e0456e1ebe7d99ccd43fa88a3653f21eb73b20a703d0adf726b5a19a20e7af5494f24511a64d1d8c3b83e787264d81efb2fde1060ab8e  use-custom-hdr_getline-func-for-all-platforms.patch"
